Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

minim-parse-result

Package Overview
Dependencies
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minim-parse-result

Minim Parse Result Namespace

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
128
decreased by-83.36%
Maintainers
6
Weekly downloads
 
Created
Source

Minim Parse Result Namespace

Build Status Coverage Status NPM version License

This library provides an interface to the Refract Parse Result namespace.

It extends upon the base types as defined in Minim and should be used with the minim-api-description package.

Elements

ParseResult (ArrayElement)

An element that holds information about the result of parsing an input.

Properties
parseResult.annotations

Get an array element of all child elements with the element name annotation. This property is ready-only.

let annotations = parseResult.annotations;
parseResult.api

Get the first child element with an element name of category and a class name of api. This property is ready-only.

let api = parseResult.api;
parseResult.errors

Get an array element of all child elements with the element name annotation and class name error. This property is ready-only.

let errors = parseResult.errors;
parseResult.warnings

Get an array element of all child elements with the element name annotation and class name warning. This property is ready-only.

let warnings = parseResult.warnings;

Annotation (StringElement)

An element that annotates the input or parse result with additional information, such as warnings or errors. The content of the annotation contains the text:

console.log(`Warning: ${annotation.getValue()}`);
Properties
annotation.code

An optional warning, error, or other numerical code. This is a shortcut for accessing the element's code attribute value.

// Show the code
console.log(annotation.code);

// Set the code
annotation.code = 123;

SourceMap (Element)

An element which maps a component of the parse result to the input via a given list of file locations and lengths.

The content of the source map is an array of locations.

Install

npm install minim-parse-result

Usage

import minim from 'minim';
import parseResult from 'minim-parse-result';

const namespace = minim.namespace()
  .use(parseResult);

// Initialize elements directly
const ParseResult = namespace.getElementClass('parseResult');
let category = new ParseResult();

FAQs

Package last updated on 28 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc